package com.lazycat.backend.service.impl.chat;

import com.lazycat.backend.mapper.PersonalMessagesMapper;
import com.lazycat.backend.pojo.PersonalMessages;
import com.lazycat.backend.service.chat.AddPersonalMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigInteger;
import java.util.HashMap;

@Service
public class AddPersonalMessageServiceImpl implements AddPersonalMessageService {

    @Autowired
    private PersonalMessagesMapper personalMessagesMapper;

    @Override
    public HashMap<String, Object> add(Integer senderId, Integer receiverId, String message, BigInteger time) {
        PersonalMessages personalMessages = new PersonalMessages(senderId, receiverId, message, time);
        personalMessagesMapper.insert(personalMessages);

        HashMap<String, Object> resp = new HashMap<>();
        resp.put("error_message", "success");
        return resp;

    }
}
